<template>
	<view>
		<cu-custom bgColor="bg-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">{{info.title}}</block>
		</cu-custom>
		<view>
			<view class="actionShow" v-if="info.fileType==0">
				<image style="width: 100%;" :src="info.file" mode="aspectFill" @tap="_previewImage(info.file)"></image>
			</view>
			<view class="actionShow" v-if="info.fileType==1">
				<video :src="info.file" controls></video>
			</view>
			<view class="sees">{{info.browseNum}}次浏览</view>
			<view class="sees" style="color: #999999;">
				{{info.briefDescription}}
			</view>
		</view>
		<view class="rich-text">
			<rich-text type="text" :nodes="demoHtml"></rich-text>
		</view>
	</view>
</template>
<script>
	var graceRichText = require("../../../service/richText.js");//富文本js
	export default {
		data() {
			return {
				id: '',//学习id
				info: {},//学习object
				demoHtml:'' //富文本内容
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getDetail(this.id)
		},
		methods: {
			_previewImage(image) {
				var imgArr = [];
				imgArr.push(image);
				//预览图片
				uni.previewImage({
					urls: imgArr,
					current: imgArr[0]
				});
			},
			getDetail(id) {
				console.log('hahha')
				let param = {
					id
				}
				this.$http('/college-service/collegeData/get', 'get', param).then(res => {
					if (res.data.code == 200) {
						this.info = res.data.data
						this.demoHtml =graceRichText.format(res.data.data.detailedDescription);
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	.actionShow {
		margin: 30rpx;
		height: 300rpx;
		video{
			width: 100%;
			height: 100%;	
		}
		image {
			width: 100%;
			height: 100%;
		}
	}
	.sees {
		margin-top: 20rpx;
		font-size: 28rpx;
		box-sizing: border-box;
		padding: 0 32rpx;
	}
	.rich-text{
		padding: 20rpx 30rpx;
	}
</style>
